package com.cloud.activiti.listener;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * 执行监听器
 * 执行监听器则监听流程的所有节点和连线。
 * 主要有start、end、take事件。
 * 其中节点有start、end两种事件，
 * 而连线则有take事件。
 */
@Component
public class CustomizeExecutionListener implements ExecutionListener, Serializable {

    @Override
    public void notify(DelegateExecution execution) {
        System.out.println("执行监听器" + execution);
        String eventName = execution.getEventName();
        String currentActivitiId = execution.getCurrentActivityId();
        System.out.println("事件名称:" + eventName);
        System.out.println("ActivitiId:" + currentActivitiId);
    }
}
